/*
 * MIT License
 *
 * Copyright (c) 2023 北京凯特伟业科技有限公司
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.je.bpm.core.model.task;

import com.je.bpm.core.model.config.task.CandidateConfigImpl;
import com.je.bpm.core.model.config.task.assignment.TaskAssigneeConfigImpl;
import com.je.bpm.core.model.exceptions.ModelException;

/**
 * 候选节点
 */
public class KaiteCandidateUserTask extends KaiteBaseUserTask {

    /**
     * 指派人配置
     */
    private TaskAssigneeConfigImpl taskAssigneeConfig = new TaskAssigneeConfigImpl();

    private CandidateConfigImpl candidateConfig = new CandidateConfigImpl();

    public CandidateConfigImpl getCandidateConfig() {
        return candidateConfig;
    }

    public void setCandidateConfig(CandidateConfigImpl candidateConfig) {
        this.candidateConfig = candidateConfig;
    }

    public TaskAssigneeConfigImpl getTaskAssigneeConfig() {
        return taskAssigneeConfig;
    }

    @Override
    public String getType() {
        return KaiteTaskCategoryEnum.JSON_KAITE_CANDIDATE_USERTASK.getType();
    }

    public void setTaskAssigneeConfig(TaskAssigneeConfigImpl taskAssigneeConfig) {
        this.taskAssigneeConfig = taskAssigneeConfig;
    }

    public KaiteCandidateUserTask() {
        this.category = KaiteTaskCategoryEnum.KAITE_CANDIDATE_USERTASK.getType();
    }


    @Override
    public KaiteCandidateUserTask clone() {
        KaiteCandidateUserTask clone = new KaiteCandidateUserTask();
        clone.setValues(this);
        return clone;
    }

    public void setValues(KaiteCandidateUserTask otherElement) {
        super.setValues(otherElement);
        setTaskAssigneeConfig(otherElement.getTaskAssigneeConfig());
    }

    @Override
    protected void setCategory(String category) {
        throw new ModelException("非法调用！平台已禁用此方法的调用");
    }

}
